home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / coolstuf / time37!.asm < prev   
Encoding:
Assembly Source File  |  1994-11-05  |  4.4 KB  |  145 lines

  1. COMMENT^
  2.  
  3. But du programme : affichage permanent de l'heure à l'ecran.
  4. ------------------
  5.  
  6. Une fois le programme mis en memoire (96 octets !!!) : il y reste !!! :)
  7. La couleur d'affichage ainsi que la position a l'ecran est parametrable.
  8.  
  9. Pour toute remarque/commentaire essayez : 0032-02/374-66-57 (demandez Michel) 
  10. ou mon E-mail (internet) : mderie@is1.vub.ac.be ... CU SOON ON IRC (#Pendu Sam_) ...
  11.  
  12. Pour recompiler : ml /AT time37!.asm
  13.  
  14. Attention : une fois en memoire, le programme se suicide apres s'etre recopie
  15.             dans le segment d'environnement (dont il change la taille) !!!
  16.  
  17. Valeur par defaut des differents parametres :
  18. ^
  19.  
  20. Couleur EQU 1Fh         ; Blanc sur fond bleu
  21. VideoBaseAdr EQU 0B800h ; attention pour les cartes hercule : 0B000h !!!
  22. Ligne EQU 1             ; de 1 a 25 ...
  23. Colonne EQU 73          ; de 1 a 80 ... rappel : huit caracteres a afficher
  24. Separateur EQU 3Ah      ; ':'
  25.  
  26. Time               SEGMENT
  27.                    ORG 100h ; c'est un .com
  28.                    ASSUME CS:Time,DS:Time
  29.  
  30. Start:             JMP Init ; Classique !
  31.  
  32. NewInt1C PROC
  33.                    PUSH AX
  34.                    PUSH BX
  35.                    PUSH CX
  36.                    PUSH DX
  37.                    PUSH ES
  38.                    PUSH DI
  39.  
  40.                    CLD ; on affiche par addr video croissante (cnf CST)
  41.                    MOV AX,VideoBaseAdr ; Cst.
  42.                    MOV ES,AX
  43.                    MOV DI,(Ligne-1)*160+(Colonne-1)*2 ; adr video !!!
  44.  
  45.                    MOV AH,2
  46.                    INT 1Ah ; get RTC value (HH-MM-SS in BCD !!!)
  47.                    MOV BX,CX ; CX = compteurs
  48.  
  49.                    MOV AL,BH ; heures
  50.                    MOV AH,Couleur ; attention reste pendant tout le programme !
  51.                    MOV CL,4 ; attention : il est utilise 3 fois !!!
  52.                    SHR AL,CL ; clear lower nibble
  53.                    OR AL,30h
  54.                    STOSW
  55.                    MOV AL,BH
  56.                    AND AL,0Fh ; conserve lower nibble
  57.                    OR AL,30h
  58.                    STOSW
  59.  
  60.                    MOV AL,Separateur
  61.                    STOSW
  62.  
  63.                    MOV AL,BL ; minutes
  64.                    SHR AL,CL
  65.                    OR AL,30h
  66.                    STOSW 
  67.                    MOV AL,BL
  68.                    AND AL,0Fh
  69.                    OR AL,30h
  70.                    STOSW
  71.  
  72.                    MOV AL,Separateur
  73.                    STOSW
  74.  
  75.                    MOV AL,DH ; secondes
  76.                    SHR AL,CL
  77.                    OR AL,30h
  78.                    STOSW
  79.                    MOV AL,DH
  80.                    AND AL,0Fh
  81.                    OR AL,30h
  82.                    STOSW
  83.  
  84.                    POP DI
  85.                    POP ES
  86.                    POP DX
  87.                    POP CX
  88.                    POP BX
  89.                    POP AX
  90.  
  91.                    DB 0EAh ; opcode d'un jump far,direction l'ancien gestionnaire
  92. Int1COfs           DW ?
  93. Int1CSeg           DW ?
  94.  
  95. NewInt1C           ENDP
  96.  
  97. ; hey DOS , cut here !!!
  98.  
  99. Init:              CLI ; foutez moi la paix ...
  100.  
  101.                    MOV AX,351Ch
  102.                    INT 21h ; get int 1C vector (timer)
  103.                    MOV Int1COfs,BX
  104.                    MOV Int1CSeg,ES
  105.  
  106.                    MOV AH,9
  107.                    MOV DX,OFFSET Copyright
  108.                    INT 21h ; qui a code ce truc ? 8-)
  109.  
  110.                    PUSH CS
  111.                    POP ES
  112.  
  113.                    MOV ES,WORD PTR ES:[2Ch]
  114.                    MOV BX,6
  115.                    MOV AH,4Ah
  116.                    INT 21h ; changer la taille du block d'envir !!! (96 octets)
  117.  
  118.                    MOV SI,NewInt1C
  119.                    XOR DI,DI
  120.                    MOV CX,84 ; taille de la routine ( <> 96 !!! il faut un multiple de 16)
  121.                    CLD
  122.                    REP MOVSB
  123.  
  124.                    MOV SI,ES
  125.                    MOV DI,SI ;sauvegarde
  126.                    DEC SI
  127.                    MOV ES,SI; ES=ES-1
  128.  
  129.                    MOV WORD PTR ES:[1],0FFFFh ; changer le owner du MCB !!!
  130.  
  131.                    XOR DX,DX
  132.                    MOV DS,DI       
  133.                    MOV AX,251Ch
  134.                    INT 21h ; detourner le timer
  135.  
  136.                    STI ; heheh
  137.  
  138.                    MOV AX,4C00h
  139.                    INT 21h ; fin du prg !!!
  140.  
  141. Copyright          DB 13,10,'Time! 3.7 - Coded By Sam In 1994 - A TFL/TDV Production - 96 Bytes In Memory !',13,10,'$'
  142.  
  143. Time               ENDS
  144.                    END Start
  145.